\(\int \sin ^n(c+d x) (a+a \sin (c+d x))^{-2-n} (-1-n-(-2-n) \sin (c+d x)) \, dx\) [14]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [F]
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [F]
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 43, antiderivative size = 37 \[ \int \sin ^n(c+d x) (a+a \sin (c+d x))^{-2-n} (-1-n-(-2-n) \sin (c+d x)) \, dx=-\frac {\cos (c+d x) \sin ^{1+n}(c+d x) (a+a \sin (c+d x))^{-2-n}}{d} \]

[Out]

-cos(d*x+c)*sin(d*x+c)^(1+n)*(a+a*sin(d*x+c))^(-2-n)/d

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.023, Rules used = {3053} \[ \int \sin ^n(c+d x) (a+a \sin (c+d x))^{-2-n} (-1-n-(-2-n) \sin (c+d x)) \, dx=-\frac {\cos (c+d x) \sin ^{n+1}(c+d x) (a \sin (c+d x)+a)^{-n-2}}{d} \]

[In]

Int[Sin[c + d*x]^n*(a + a*Sin[c + d*x])^(-2 - n)*(-1 - n - (-2 - n)*Sin[c + d*x]),x]

[Out]

-((Cos[c + d*x]*Sin[c + d*x]^(1 + n)*(a + a*Sin[c + d*x])^(-2 - n))/d)

Rule 3053

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(B*c - A*d)*Cos[e + f*x]*(a + b*Sin[e + f*x])^m*((c + d*Sin[e + f*x]
)^(n + 1)/(f*(n + 1)*(c^2 - d^2))), x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && NeQ[b*c - a*d, 0] && EqQ
[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && EqQ[m + n + 2, 0] && EqQ[A*(a*d*m + b*c*(n + 1)) - B*(a*c*m + b*d*(n +
1)), 0]

Rubi steps \begin{align*} \text {integral}& = -\frac {\cos (c+d x) \sin ^{1+n}(c+d x) (a+a \sin (c+d x))^{-2-n}}{d} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(107\) vs. \(2(37)=74\).

Time = 5.07 (sec) , antiderivative size = 107, normalized size of antiderivative = 2.89 \[ \int \sin ^n(c+d x) (a+a \sin (c+d x))^{-2-n} (-1-n-(-2-n) \sin (c+d x)) \, dx=-\frac {2^n \sin \left (\frac {1}{2} (c+d x)\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right ) \left (\cos \left (\frac {1}{4} (c+d x)\right ) \left (-\sin \left (\frac {1}{4} (c+d x)\right )+\sin \left (\frac {3}{4} (c+d x)\right )\right )\right )^n (1+\cos (c+d x)-\sin (c+d x)) (a (1+\sin (c+d x)))^{-2-n}}{d} \]

[In]

Integrate[Sin[c + d*x]^n*(a + a*Sin[c + d*x])^(-2 - n)*(-1 - n - (-2 - n)*Sin[c + d*x]),x]

[Out]

-((2^n*Sin[(c + d*x)/2]*(Cos[(c + d*x)/2] + Sin[(c + d*x)/2])*(Cos[(c + d*x)/4]*(-Sin[(c + d*x)/4] + Sin[(3*(c
 + d*x))/4]))^n*(1 + Cos[c + d*x] - Sin[c + d*x])*(a*(1 + Sin[c + d*x]))^(-2 - n))/d)

Maple [F]

\[\int \left (\sin ^{n}\left (d x +c \right )\right ) \left (a +a \sin \left (d x +c \right )\right )^{-2-n} \left (-1-n -\left (-2-n \right ) \sin \left (d x +c \right )\right )d x\]

[In]

int(sin(d*x+c)^n*(a+a*sin(d*x+c))^(-2-n)*(-1-n-(-2-n)*sin(d*x+c)),x)

[Out]

int(sin(d*x+c)^n*(a+a*sin(d*x+c))^(-2-n)*(-1-n-(-2-n)*sin(d*x+c)),x)

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 41, normalized size of antiderivative = 1.11 \[ \int \sin ^n(c+d x) (a+a \sin (c+d x))^{-2-n} (-1-n-(-2-n) \sin (c+d x)) \, dx=-\frac {{\left (a \sin \left (d x + c\right ) + a\right )}^{-n - 2} \sin \left (d x + c\right )^{n} \cos \left (d x + c\right ) \sin \left (d x + c\right )}{d} \]

[In]

integrate(sin(d*x+c)^n*(a+a*sin(d*x+c))^(-2-n)*(-1-n-(-2-n)*sin(d*x+c)),x, algorithm="fricas")

[Out]

-(a*sin(d*x + c) + a)^(-n - 2)*sin(d*x + c)^n*cos(d*x + c)*sin(d*x + c)/d

Sympy [F]

\[ \int \sin ^n(c+d x) (a+a \sin (c+d x))^{-2-n} (-1-n-(-2-n) \sin (c+d x)) \, dx=\int \left (a \left (\sin {\left (c + d x \right )} + 1\right )\right )^{- n - 2} \left (n \sin {\left (c + d x \right )} - n + 2 \sin {\left (c + d x \right )} - 1\right ) \sin ^{n}{\left (c + d x \right )}\, dx \]

[In]

integrate(sin(d*x+c)**n*(a+a*sin(d*x+c))**(-2-n)*(-1-n-(-2-n)*sin(d*x+c)),x)

[Out]

Integral((a*(sin(c + d*x) + 1))**(-n - 2)*(n*sin(c + d*x) - n + 2*sin(c + d*x) - 1)*sin(c + d*x)**n, x)

Maxima [F]

\[ \int \sin ^n(c+d x) (a+a \sin (c+d x))^{-2-n} (-1-n-(-2-n) \sin (c+d x)) \, dx=\int { {\left ({\left (n + 2\right )} \sin \left (d x + c\right ) - n - 1\right )} {\left (a \sin \left (d x + c\right ) + a\right )}^{-n - 2} \sin \left (d x + c\right )^{n} \,d x } \]

[In]

integrate(sin(d*x+c)^n*(a+a*sin(d*x+c))^(-2-n)*(-1-n-(-2-n)*sin(d*x+c)),x, algorithm="maxima")

[Out]

integrate(((n + 2)*sin(d*x + c) - n - 1)*(a*sin(d*x + c) + a)^(-n - 2)*sin(d*x + c)^n, x)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 9496 vs. \(2 (37) = 74\).

Time = 84.24 (sec) , antiderivative size = 9496, normalized size of antiderivative = 256.65 \[ \int \sin ^n(c+d x) (a+a \sin (c+d x))^{-2-n} (-1-n-(-2-n) \sin (c+d x)) \, dx=\text {Too large to display} \]

[In]

integrate(sin(d*x+c)^n*(a+a*sin(d*x+c))^(-2-n)*(-1-n-(-2-n)*sin(d*x+c)),x, algorithm="giac")

[Out]

-8*(cos(-1/2*pi + 2*pi*n*floor(-1/8*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x
 + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2) + 5/8) + 1/4*pi*n*sgn(4*
tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d
*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2) - 1/4*pi*n + 4*pi*floor(-1/8*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/
2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x +
 1/2*c) + 2) + 5/8) + 1/2*pi*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*
c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2))*e^(-n*log(sqrt(2)*sqrt(abs(4*t
an(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*
x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/
2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan
(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2
*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(1/2*d*x + 1/2*c)
^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 +
2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2))*abs(a)/(tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + tan(d*
x + c)^2 + tan(1/2*d*x + 1/2*c)^2 + 1)) + n*log(4*abs(tan(1/2*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^2 + 1)) - 2*
log(sqrt(2)*sqrt(abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d
*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + abs
(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/
2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 +
8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) +
 2)*tan(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*
c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2))*abs(a)/(tan(d*x + c)^2*tan(1/2
*d*x + 1/2*c)^2 + tan(d*x + c)^2 + tan(1/2*d*x + 1/2*c)^2 + 1)))*tan(1/4*pi*n*sgn(2*a*tan(1/2*d*x + 1/2*c)^4 +
 4*a*tan(1/2*d*x + 1/2*c)^3 - 4*a*tan(1/2*d*x + 1/2*c) - 2*a)*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x
 + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) - 1/4*pi*n*sgn(tan(1/2*d*x + 1/2*c)^2 - 1)*sgn(tan(1/2*d*x + 1/2*c)) +
 1/4*pi*n*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) + 1/2*pi*sgn
(2*a*tan(1/2*d*x + 1/2*c)^4 + 4*a*tan(1/2*d*x + 1/2*c)^3 - 4*a*tan(1/2*d*x + 1/2*c) - 2*a)*sgn(4*a*tan(1/2*d*x
 + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) - 1/4*pi*n - pi*floor(d*x/pi + c/pi + 1/2
) + 1/2*pi*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)))^2*tan(1/2*
d*x + 1/2*c)^3 - 2*e^(-n*log(sqrt(2)*sqrt(abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1
/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2*tan
(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*
tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2 + abs(4*tan(d*x + c)^2*
tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 +
 8*tan(1/2*d*x + 1/2*c) + 2)*tan(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x
+ c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2))*abs(a
)/(tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + tan(d*x + c)^2 + tan(1/2*d*x + 1/2*c)^2 + 1)) + n*log(4*abs(tan(1/2
*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^2 + 1)) - 2*log(sqrt(2)*sqrt(abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2
+ 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c)
 + 2)*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*t
an(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2
 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*
tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x
 + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*
d*x + 1/2*c) + 2))*abs(a)/(tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + tan(d*x + c)^2 + tan(1/2*d*x + 1/2*c)^2 + 1
)))*sin(-1/2*pi + 2*pi*n*floor(-1/8*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x
 + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2) + 5/8) + 1/4*pi*n*sgn(4*
tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d
*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2) - 1/4*pi*n + 4*pi*floor(-1/8*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/
2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x +
 1/2*c) + 2) + 5/8) + 1/2*pi*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*
c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2))*tan(1/4*pi*n*sgn(2*a*tan(1/2*d
*x + 1/2*c)^4 + 4*a*tan(1/2*d*x + 1/2*c)^3 - 4*a*tan(1/2*d*x + 1/2*c) - 2*a)*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 +
8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) - 1/4*pi*n*sgn(tan(1/2*d*x + 1/2*c)^2 - 1)*sgn(tan(1/2*
d*x + 1/2*c)) + 1/4*pi*n*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c
)) + 1/2*pi*sgn(2*a*tan(1/2*d*x + 1/2*c)^4 + 4*a*tan(1/2*d*x + 1/2*c)^3 - 4*a*tan(1/2*d*x + 1/2*c) - 2*a)*sgn(
4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) - 1/4*pi*n - pi*floor(d*x/
pi + c/pi + 1/2) + 1/2*pi*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*
c)))*tan(1/2*d*x + 1/2*c)^3 - cos(-1/2*pi + 2*pi*n*floor(-1/8*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*
tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2
) + 5/8) + 1/4*pi*n*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*ta
n(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2) - 1/4*pi*n + 4*pi*floor(-1/8*sgn(4*tan(d
*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x +
1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2) + 5/8) + 1/2*pi*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x
 + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2))*e^(-
n*log(sqrt(2)*sqrt(abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan
(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + a
bs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(
1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2
+ 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c)
 + 2)*tan(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/
2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2))*abs(a)/(tan(d*x + c)^2*tan(1
/2*d*x + 1/2*c)^2 + tan(d*x + c)^2 + tan(1/2*d*x + 1/2*c)^2 + 1)) + n*log(4*abs(tan(1/2*d*x + 1/2*c))/(tan(1/2
*d*x + 1/2*c)^2 + 1)) - 2*log(sqrt(2)*sqrt(abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(
1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2*ta
n(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4
*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2 + abs(4*tan(d*x + c)^2
*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2
+ 8*tan(1/2*d*x + 1/2*c) + 2)*tan(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x
 + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2))*abs(
a)/(tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + tan(d*x + c)^2 + tan(1/2*d*x + 1/2*c)^2 + 1)))*tan(1/4*pi*n*sgn(2*
a*tan(1/2*d*x + 1/2*c)^4 + 4*a*tan(1/2*d*x + 1/2*c)^3 - 4*a*tan(1/2*d*x + 1/2*c) - 2*a)*sgn(4*a*tan(1/2*d*x +
1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) - 1/4*pi*n*sgn(tan(1/2*d*x + 1/2*c)^2 - 1)*s
gn(tan(1/2*d*x + 1/2*c)) + 1/4*pi*n*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*
d*x + 1/2*c)) + 1/2*pi*sgn(2*a*tan(1/2*d*x + 1/2*c)^4 + 4*a*tan(1/2*d*x + 1/2*c)^3 - 4*a*tan(1/2*d*x + 1/2*c)
- 2*a)*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) - 1/4*pi*n - pi
*floor(d*x/pi + c/pi + 1/2) + 1/2*pi*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2
*d*x + 1/2*c)))^2*tan(1/2*d*x + 1/2*c) - cos(-1/2*pi + 2*pi*n*floor(-1/8*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/
2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x +
 1/2*c) + 2) + 5/8) + 1/4*pi*n*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/
2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2) - 1/4*pi*n + 4*pi*floor(-1/8*
sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan
(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2) + 5/8) + 1/2*pi*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2
+ 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c)
 + 2))*e^(-n*log(sqrt(2)*sqrt(abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2
*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2*tan(1/2*d*x + 1
/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)
^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x
+ 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d
*x + 1/2*c) + 2)*tan(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1
/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2))*abs(a)/(tan(d*x +
 c)^2*tan(1/2*d*x + 1/2*c)^2 + tan(d*x + c)^2 + tan(1/2*d*x + 1/2*c)^2 + 1)) + n*log(4*abs(tan(1/2*d*x + 1/2*c
))/(tan(1/2*d*x + 1/2*c)^2 + 1)) - 2*log(sqrt(2)*sqrt(abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x
+ c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*
x + c)^2*tan(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x +
 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2 + abs(4*tan
(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x
+ 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2
+ 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c)
 + 2))*abs(a)/(tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + tan(d*x + c)^2 + tan(1/2*d*x + 1/2*c)^2 + 1)))*tan(1/2*
d*x + 1/2*c)^3 + 2*e^(-n*log(sqrt(2)*sqrt(abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1
/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2*tan
(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*
tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2 + abs(4*tan(d*x + c)^2*
tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 +
 8*tan(1/2*d*x + 1/2*c) + 2)*tan(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x
+ c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2))*abs(a
)/(tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + tan(d*x + c)^2 + tan(1/2*d*x + 1/2*c)^2 + 1)) + n*log(4*abs(tan(1/2
*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^2 + 1)) - 2*log(sqrt(2)*sqrt(abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2
+ 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c)
 + 2)*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*t
an(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2
 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*
tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x
 + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*
d*x + 1/2*c) + 2))*abs(a)/(tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + tan(d*x + c)^2 + tan(1/2*d*x + 1/2*c)^2 + 1
)))*sin(-1/2*pi + 2*pi*n*floor(-1/8*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x
 + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2) + 5/8) + 1/4*pi*n*sgn(4*
tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d
*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2) - 1/4*pi*n + 4*pi*floor(-1/8*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/
2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x +
 1/2*c) + 2) + 5/8) + 1/2*pi*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*
c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2))*tan(1/4*pi*n*sgn(2*a*tan(1/2*d
*x + 1/2*c)^4 + 4*a*tan(1/2*d*x + 1/2*c)^3 - 4*a*tan(1/2*d*x + 1/2*c) - 2*a)*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 +
8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) - 1/4*pi*n*sgn(tan(1/2*d*x + 1/2*c)^2 - 1)*sgn(tan(1/2*
d*x + 1/2*c)) + 1/4*pi*n*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c
)) + 1/2*pi*sgn(2*a*tan(1/2*d*x + 1/2*c)^4 + 4*a*tan(1/2*d*x + 1/2*c)^3 - 4*a*tan(1/2*d*x + 1/2*c) - 2*a)*sgn(
4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) - 1/4*pi*n - pi*floor(d*x/
pi + c/pi + 1/2) + 1/2*pi*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*
c)))*tan(1/2*d*x + 1/2*c) + cos(-1/2*pi + 2*pi*n*floor(-1/8*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*ta
n(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)
+ 5/8) + 1/4*pi*n*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(
d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2) - 1/4*pi*n + 4*pi*floor(-1/8*sgn(4*tan(d*x
 + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/
2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2) + 5/8) + 1/2*pi*sgn(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x +
 c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2))*e^(-n*
log(sqrt(2)*sqrt(abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d
*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + abs
(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/
2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 +
8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) +
 2)*tan(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*
c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2))*abs(a)/(tan(d*x + c)^2*tan(1/2
*d*x + 1/2*c)^2 + tan(d*x + c)^2 + tan(1/2*d*x + 1/2*c)^2 + 1)) + n*log(4*abs(tan(1/2*d*x + 1/2*c))/(tan(1/2*d
*x + 1/2*c)^2 + 1)) - 2*log(sqrt(2)*sqrt(abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/
2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2*tan(
1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*t
an(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2)*tan(d*x + c)^2 + abs(4*tan(d*x + c)^2*t
an(1/2*d*x + 1/2*c)^2 + 8*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 +
8*tan(1/2*d*x + 1/2*c) + 2)*tan(1/2*d*x + 1/2*c)^2 + abs(4*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(d*x +
 c)^2*tan(1/2*d*x + 1/2*c) + 4*tan(d*x + c)^2 + 2*tan(1/2*d*x + 1/2*c)^2 + 8*tan(1/2*d*x + 1/2*c) + 2))*abs(a)
/(tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + tan(d*x + c)^2 + tan(1/2*d*x + 1/2*c)^2 + 1)))*tan(1/2*d*x + 1/2*c))
/(d*tan(1/4*pi*n*sgn(2*a*tan(1/2*d*x + 1/2*c)^4 + 4*a*tan(1/2*d*x + 1/2*c)^3 - 4*a*tan(1/2*d*x + 1/2*c) - 2*a)
*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) - 1/4*pi*n*sgn(tan(1/
2*d*x + 1/2*c)^2 - 1)*sgn(tan(1/2*d*x + 1/2*c)) + 1/4*pi*n*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x +
1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) + 1/2*pi*sgn(2*a*tan(1/2*d*x + 1/2*c)^4 + 4*a*tan(1/2*d*x + 1/2*c)^3 - 4*
a*tan(1/2*d*x + 1/2*c) - 2*a)*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x +
1/2*c)) - 1/4*pi*n - pi*floor(d*x/pi + c/pi + 1/2) + 1/2*pi*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x +
 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)))^2*tan(1/2*d*x + 1/2*c)^4 + 2*d*tan(1/4*pi*n*sgn(2*a*tan(1/2*d*x + 1/2*c
)^4 + 4*a*tan(1/2*d*x + 1/2*c)^3 - 4*a*tan(1/2*d*x + 1/2*c) - 2*a)*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/
2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) - 1/4*pi*n*sgn(tan(1/2*d*x + 1/2*c)^2 - 1)*sgn(tan(1/2*d*x + 1/2*
c)) + 1/4*pi*n*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) + 1/2*p
i*sgn(2*a*tan(1/2*d*x + 1/2*c)^4 + 4*a*tan(1/2*d*x + 1/2*c)^3 - 4*a*tan(1/2*d*x + 1/2*c) - 2*a)*sgn(4*a*tan(1/
2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) - 1/4*pi*n - pi*floor(d*x/pi + c/pi
+ 1/2) + 1/2*pi*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)))^2*tan
(1/2*d*x + 1/2*c)^2 + d*tan(1/2*d*x + 1/2*c)^4 + d*tan(1/4*pi*n*sgn(2*a*tan(1/2*d*x + 1/2*c)^4 + 4*a*tan(1/2*d
*x + 1/2*c)^3 - 4*a*tan(1/2*d*x + 1/2*c) - 2*a)*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 +
4*a*tan(1/2*d*x + 1/2*c)) - 1/4*pi*n*sgn(tan(1/2*d*x + 1/2*c)^2 - 1)*sgn(tan(1/2*d*x + 1/2*c)) + 1/4*pi*n*sgn(
4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) + 1/2*pi*sgn(2*a*tan(1/2*d
*x + 1/2*c)^4 + 4*a*tan(1/2*d*x + 1/2*c)^3 - 4*a*tan(1/2*d*x + 1/2*c) - 2*a)*sgn(4*a*tan(1/2*d*x + 1/2*c)^3 +
8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)) - 1/4*pi*n - pi*floor(d*x/pi + c/pi + 1/2) + 1/2*pi*sgn
(4*a*tan(1/2*d*x + 1/2*c)^3 + 8*a*tan(1/2*d*x + 1/2*c)^2 + 4*a*tan(1/2*d*x + 1/2*c)))^2 + 2*d*tan(1/2*d*x + 1/
2*c)^2 + d)

Mupad [B] (verification not implemented)

Time = 12.93 (sec) , antiderivative size = 61, normalized size of antiderivative = 1.65 \[ \int \sin ^n(c+d x) (a+a \sin (c+d x))^{-2-n} (-1-n-(-2-n) \sin (c+d x)) \, dx=-\frac {{\sin \left (c+d\,x\right )}^n\,\sin \left (2\,c+2\,d\,x\right )}{a^2\,d\,{\left (a\,\left (\sin \left (c+d\,x\right )+1\right )\right )}^n\,\left (2\,{\sin \left (c+d\,x\right )}^2+4\,\sin \left (c+d\,x\right )+2\right )} \]

[In]

int(-(sin(c + d*x)^n*(n - sin(c + d*x)*(n + 2) + 1))/(a + a*sin(c + d*x))^(n + 2),x)

[Out]

-(sin(c + d*x)^n*sin(2*c + 2*d*x))/(a^2*d*(a*(sin(c + d*x) + 1))^n*(4*sin(c + d*x) + 2*sin(c + d*x)^2 + 2))